<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理-登陆</title>
    <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>

    <style>
        body {
            background: url("../img/00.png") 100% 0;
            height: 100%;
            width: 100%;
        }

        #container {
            height: 100%;
            width: 100%;
        }

        input:-webkit-autofill {
            -webkit-box-shadow: inset 0 0 0 1000px #fff;
            background-color: transparent;
        }

        .admin-login-background {
            width: 300px;
            height: 300px;
            position: absolute;
            left: 50%;
            top: 40%;
            margin-left: -150px;
            margin-top: -100px;
        }

        .admin-header {
            text-align: center;
            margin-bottom: 20px;
            color: #a78369;
            font-weight: bold;
            font-size: 40px
        }

        .admin-input {
            border-top-style: none;
            border-right-style: solid;
            border-bottom-style: solid;
            border-left-style: solid;
            height: 50px;
            width: 300px;
            padding-bottom: 0px;
        }

        .admin-input::-webkit-input-placeholder {
            color: #a78369
        }

        .layui-icon-username {
            color: #a78369 !important;
        }

        .layui-icon-username:hover {
            color: #9dadce !important;
        }

        .layui-icon-password {
            color: #a78369 !important;
        }

        .layui-icon-password:hover {
            color: #9dadce !important;
        }

        .admin-input-username {
            border-top-style: solid;
            border-radius: 10px 10px 0 0;
        }

        .admin-button {
            margin-top: 20px;
            font-weight: bold;
            font-size: 18px;
            width: 300px;
            height: 50px;
            border-radius: 5px;
            background-color: #a78369;
            border: 1px solid #d8b29f
        }

        .admin-icon {
            margin-left: 260px;
            margin-top: 10px;
            font-size: 30px;
        }

        i {
            position: absolute;
        }
    </style>
</head>
<body>
<div id="container">
    <div></div>
    <div class="admin-login-background">
        <div class="admin-header">
            <span>疫情管理系统</span>
        </div>
        <form class="layui-form" action="">
            <div>
                <i class="layui-icon layui-icon-username admin-icon"></i>
                <input type="text" name="username" value="admin" placeholder="请输入用户名" autocomplete="off"
                       class="layui-input admin-input admin-input-username">
            </div>
            <div>
                <i class="layui-icon layui-icon-password admin-icon"></i>
                <input type="password" name="password" value="1234" placeholder="请输入密码" autocomplete="off"
                       class="layui-input admin-input">
            </div>
            <button class="layui-btn admin-button" lay-submit="" lay-filter="" onclick="UserLogin()">登 陆</button>
            <a href="regist.html" style="color: #007DDB">没有账号?立即注册</a>
        </form>
    </div>
</div>
<script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>

    function UserLogin() {
        var datas = $("form").serialize();

            $.post("/login", datas, function (result) {

                if (result.code == 900) {
                    alert(result.msg)
                    return false;
                }else if (result.code == 200){
                    alert(result.code + '-----' + result.msg)
                    window.location = 'country.html';
                }
            })
    }

    // layui.use(['form'], function () {
    //     var form = layui.form,
    //         layer = layui.layer;
    //
    //     // 登录过期的时候，跳出ifram框架
    //     if (top.location != self.location) top.location = self.location;
    //
    //     // 进行登录操作
    //     form.on('submit(login)', function (data) {
    //         data = data.field;
    //         if (data.username == '') {
    //             layer.msg('用户名不能为空');
    //             return false;
    //         }
    //         if (data.password == '') {
    //             layer.msg('密码不能为空');
    //             return false;
    //         }
    //         if (data.captcha == '') {
    //             layer.msg('验证码不能为空');
    //             return false;
    //         }
    //         layer.msg('登录成功', function () {
    //             window.location = 'country.html';
    //         });
    //         return false;
    //     });
    // });
</script>
</body>
</html>